Módulo 3: Apresentando suas análises
PROFESP, DEMSP, MS
Tutoriais pacotes: maps, ggplot, geobr1, geobr2, intorducao ao geobr
brasil_bruto <- import("Exercicios/covid_br_2022.csv")
estados <- read_sf(dsn = "Exercicios/shapefiles/.",
layer="UFBR")
# tratando os dados
brasil_acumulado_estado <- brasil_bruto %>%
filter(municipio!="")%>%
group_by(estado) %>%
summarise(Acumulado=sum(casosNovos, na.rm=T))
estados_trat <- estados %>%
rename(estado=SIGLA) %>%
st_zm() # as vezes precisa, nem sempre
covid_brasil_com_shape <- left_join(brasil_acumulado_estado, estados_trat) function geography
1 `read_country` Country
2 `read_region` Region
3 `read_state` States
4 `read_meso_region` Meso region
5 `read_micro_region` Micro region
6 `read_intermediate_region` Intermediate region
years
1 1872, 1900, 1911, 1920, 1933, 1940, 1950, 1960, 1970, 1980, 1991, 2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
2 2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
3 1872, 1900, 1911, 1920, 1933, 1940, 1950, 1960, 1970, 1980, 1991, 2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
4 2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
5 2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
6 2017, 2019, 2020
source
1 IBGE
2 IBGE
3 IBGE
4 IBGE
5 IBGE
6 IBGE
regiao_geobr <- read_region() %>%
rename(regiao=`name_region`) %>%
mutate(regiao=if_else(regiao=="Centro Oeste", "Centro-Oeste", regiao))
Downloading: 5.1 kB
Downloading: 5.1 kB
Downloading: 19 kB
Downloading: 19 kB
Downloading: 91 kB
Downloading: 91 kB
Downloading: 91 kB
Downloading: 91 kB
Downloading: 200 kB
Downloading: 200 kB
Downloading: 290 kB
Downloading: 290 kB
Downloading: 390 kB
Downloading: 390 kB
Downloading: 390 kB
Downloading: 390 kB
Downloading: 520 kB
Downloading: 520 kB
Downloading: 540 kB
Downloading: 540 kB
Downloading: 560 kB
Downloading: 560 kB
Downloading: 590 kB
Downloading: 590 kB
Downloading: 590 kB
Downloading: 590 kB
Downloading: 710 kB
Downloading: 710 kB
Downloading: 780 kB
Downloading: 780 kB
Downloading: 780 kB
Downloading: 780 kB
Reading layer `map' from data source
`/Users/carolinamusso/Desktop/R-PROFESP/Exercicios/map.gpkg'
using driver `GPKG'
Simple feature collection with 10 features and 2 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: 4.944039 ymin: 873.8405 xmax: 20.01296 ymax: 896.602
Projected CRS: Undefined Cartesian SRS
st_crs(map) <- 4326
# Esse arquivo especificamente
map_transformed <- st_transform(map, crs = 4326)
(ggmap <- map_transformed %>%
ggplot()+
geom_sf(aes(geometry=geom, fill=hdi))+
scale_fill_distiller(direction=1)+
theme_map())